<?php

class IndexController extends Zend_Controller_Action  
{
    public function indexAction()
    {
		//$this->_redirect("/product/");
		$langCode = My_Translate::getLanguageCode();
		if($langCode == "vn")
		{
			$id = 28;
			$humanId = 31;
		}
		else
		{
			$id = 29;
			$humanId = 30;
		}
		$service = new ContentService();
		$content = $service->load($id);
		$this->view->content = $content;
		
		$humanContent = $service->load($humanId);
		$activityContent = $service->getFirstEvent();
		
		$this->view->human = $humanContent->summary;
		$this->view->activity = $activityContent[0]['summary'];
		$this->view->activityImg = $activityContent[0]['imageURL'];
		
		/*$service = new ProductService();
		$products = $service->getTopProducts();
		$this->view->products = $products;*/
		
		$dbAdapter = Zend_Registry::get("dpAdapter",$dbAdapter);
    	$data = array(
	   			 'visited'      => new Zend_Db_Expr('visited + 1'),
    	);

    	$dbAdapter->update('info', $data);
    	
    }
	
	public function pageAction()
	{
		$type = $this->_getParam("type");
		if(empty($type))
    	{
    		$this->_redirect("/index");exit;
    	}
    	
		$service = new ContentService();
		$content = $service->getContentWithType($type);
		$this->view->content = $content;
	}
	
	public function testAction()
	{
		
	}

}

